package com.bwie.rabbitconfig;

import com.bwie.utils.R;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.CustomExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.HashMap;

/**
 * TODO
 *
 * @Description
 * @Author 36167
 * @Date 2025/3/10 22:45
 **/


@Component
public class RabbitConfig {


    @Bean
    public CustomExchange customExchange(){
        HashMap<String, Object> map = new HashMap<>();
        map.put("x-delayed-type","direct");
        return new CustomExchange("day3-10","x-delayed-message",true,false,map);
    }

    @Bean
    public Queue queue(){
        return new Queue("xty",true,false,false,null);
    }

    @Bean
    public Queue queue1(){
        return new Queue("day3-12",true,false,false,null);
    }

    @Bean
    public Binding binding(){
        return BindingBuilder.bind(queue()).to(customExchange()).with("").noargs();
    }

    @Bean
    public Binding binding1(){
        return BindingBuilder.bind(queue1()).to(customExchange()).with("xty").noargs();
    }

}
